/**
* Author: Bob Chen
*/

package net.uman.framework.modules.search;

import java.util.ArrayList;
import java.util.List;

public class Criteria {
    private List<Condition> conditions = new ArrayList<Condition>();
    private List<Order> orders = new ArrayList<Order>();
    private List<String> groups = new ArrayList<String>();

    private int relation = AND;
	public static final int AND = 0;
    public static final int OR = 1;
//    public static final int NOT = 2;
    
    public Criteria()
    {
    }
    
    public Criteria(int relation)
    {
    	this.relation = relation;
    }

	public int getRelation() {
		return relation;
	}

	public void setRelation(int relation) {
		this.relation = relation;
	}

	public List<Condition> getConditions() {
        return conditions;
    }

    public void setConditions(List<Condition> conditions) {
        this.conditions = conditions;
    }
    
    public void addCondition(Condition condition) {
        conditions.add(condition);
    }

    public void removeCondition(Condition condition) {
        conditions.remove(condition);
    }

    public void removeAll(){
    	conditions.clear();
    	orders.clear();
    }

    public List<Order> getOrders() {
        return orders;
    }

    public void setOrder(List<Order> orders) {
        this.orders = orders;
    }
    
    public void addOrder(Order order) {
        orders.add(order);
    }

    public void removeOrder(Order order) {
        orders.remove(order);
    }

	public List<String> getGroups() {
		return groups;
	}

	public void setGroups(List<String> groups) {
		this.groups = groups;
	}
}
